package com.sneakxy.cloudbase.platform.utils.feign;

import org.apache.commons.lang3.StringUtils;

public class TokenHolder {

	public static final String TOKEN_NAME = "CLOUD-BASE-TOKEN";
	
	public static final String SESSIOIN_COOKIE_NAME = "CLOUD-BASE-SESSION";
	
	protected static final ThreadLocal<String> TOKEN = new ThreadLocal<>();
	
	public static void bind(String token) {
		if(StringUtils.isNotBlank(token)) {
			TOKEN.set(token);
		}
	}
	
	public static String token() {
		return TOKEN.get();
	}
	
	public static void unbind() {
		TOKEN.remove();
	}
	
	private TokenHolder() {}
	
}
